-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test cases for EnumerableGuardianMap. #6
Conversation
|
||
function test_Set_RevertWhen_MaxNumberOfGuardiansReached() public { | ||
bool result; | ||
// TODO: Can it be acceptable to number 33? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding current implementation, it allows to store 33 guardians. Is that expected behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes good catch, expected behaviour should be 32. Could you change to assertion in the library to ensure that the max number is 32?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JohnGuilding Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for getting these done. Left some comments.
Before merging into main will need to merge the latest changes as there are some merge conflicts.
} | ||
|
||
function test_Keys_ReturnsEmptyArrayOfKeys() public view { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, can you remove this test case then?
addresses[0] = vm.addr(1); | ||
addresses[1] = vm.addr(2); | ||
addresses[2] = vm.addr(3); | ||
guardiansStorage[accountAddress].removeAll(addresses); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an assert to check that the values are no longer in storage?
) { | ||
addresses[i] = vm.addr(i + 1); | ||
} | ||
guardiansStorage[accountAddress].removeAll(addresses); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, can you add an assert to check that the values are no longer in storage?
guardiansStorage[accountAddress].set({ | ||
key: guardian1, | ||
value: GuardianStorage(GuardianStatus.REQUESTED, guardianWeights[1]) | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an assert here
assertEq(recoveryRequest.executeAfter, 0); | ||
assertEq(recoveryRequest.executeBefore, 0); | ||
assertEq(recoveryRequest.currentWeight, 1); | ||
assertEq(recoveryRequest.calldataHashString, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you merge the latest changes in, this has been changed to bytes32 from a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.